home *** CD-ROM | disk | FTP | other *** search
- #ifndef EGS_EGSLAYERS_H
- #define EGS_EGSLAYERS_H
-
- /***************************************************************************\
- *
- * $
- * $ FILE : egslayers.h
- * $ VERSION : 1
- * $ REVISION : 3
- * $ DATE : 08-Dec-93 12:45
- * $
- * $ Author : mvk
- * $
- *
- *****************************************************************************
- * *
- * (c) Copyright 1990/94 VIONA Development *
- * All Rights Reserved *
- * *
- \***************************************************************************/
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
- #ifndef EXEC_PORTS_H
- #include <exec/ports.h>
- #endif
- #ifndef EXEC_LISTS_H
- #include <exec/lists.h>
- #endif
- #ifndef EXEC_SEMAPHORES_H
- #include <exec/semaphores.h>
- #endif
- #ifndef EGS_EGS_H
- #include <egs/egs.h>
- #endif
- #ifndef EGS_EGSBLIT_H
- #include <egs/egsblit.h>
- #endif
-
-
-
- /*
- * This library manages overlapping, independent, rectangular screen areas
- * (layers). They form the base of each window system.
- *
- * Layers can be moved, sized and put from front to back or vice versa. The
- * library offers adequate functions. Areas to be clipped, hidden and
- * restored are held in lists of "ClipRects". That structure is defined in
- * EGSBlit so there are no complications for clipping.
- *
- * Currently four kinds of layers are supported:
- *
- * - no care refresh : Layer parts hidden by other layers are never refreshed.
- * No list of rectangles to be refreshed is kept.
- * This layer kind is recommended if the layer's contents
- * are automatically refreshed in constant intervals,
- * e.g. for animation.
- *
- * - simple refresh : The library keeps a list which contains the parts that
- * need refreshing. If this list changes, i.e. if refresh
- * is needed, an appropriate message is sent to a given
- * port.
- * Then the program should refresh it's display. For this,
- * "BeginRefresh" and "EndRefresh" claim the part to be
- * refreshed as the current drawing area so that only the
- * damaged screen parts are drawn into during refresh.
- * This layer kind is the best compromise between memory
- * usage and execution speed. It should be used whenever
- * possible since layers saving their hidden parts eat
- * a lot of memory in high resolution graphics.
- *
- * - super bitmap : These layers own a Bitmap that can greatly exceed the
- * visible portion. The layer forms a window over this
- * BitMap that you may move as you like. Damaged screen
- * areas are refreshed by restoring them with data from
- * this special background BitMap. This layer's disad-
- * vantage is the gigantic memory requirement. You should
- * use them only if really necessary, e.g. pixel oriented
- * graphics.
- *
- * - smart refresh : For all obscured areas, these layers create restoring
- * areas which are managed dynamically and are later
- * freed automatically.
- * So you need not pay attention to refresh as drawing
- * operations are performed even in these restoring areas.
- * But a refresh message is sent as soon as the layer is
- * sized.
- * The disadvantage of this layer is its gigantic memory
- * usage especially for big bit depths. You should
- * use this type in such screens scarcely.
- *
- */
-
-
-
- /*
- * LayerFlags, LayerFlagSet
- *
- * - SIMPLE_REFRESH : Set if "simple refresh layer".
- * - SUPER_BITMAP : Set if "super bitmap layer".
- * - SMART_REFRESH : Set if "smart refresh layer".
- *
- * - IN_REFRESH : Layer is currently being refreshed.
- * - NEW_TO_REFRESH...
- * - TO_REFRESH : Layer needs a refresh.
- * - NO_BACKFILL : If an obscured layer part is made visible, this part
- * is filled with the layer's background colour. If this
- * flag is set then no fill occurs. This saves time if
- * the part will be overwritten completely during refresh
- * anyway (e.g. window border).
- * - CLIPS_INVALID : The layer was modified after this flag had been cleared
- * the last time. You can use this flag to put an addi-
- * tional Clip region over the layer.
- * - BACKDROP : The layer lies behind all non-backdrop-layers.
- *
- */
-
- /* Corresponding LayerFlagSet has 32 bits ! */
-
- #define EL_SIMPLE_REFRESH (1<<0)
- #define EL_SUPER_BITMAP (1<<1)
- #define EL_IN_REFRESH (1<<2)
- #define EL_NEW_TO_REFRESH (1<<3)
- #define EL_TO_REFRESH (1<<4)
- #define EL_NO_BACKFILL (1<<5)
- #define EL_OBSOLETE1 (1<<6)
- #define EL_BACKDROP (1<<7)
- #define EL_SMART_REFRESH (1<<8)
-
- typedef struct EL_LayerInfo *EL_LayerInfoPtr;
-
- /*
- * Layer, LayerPtr
- *
- * Structure for management of a layer.
- *
- * !!! READ-ONLY !!!
- *
- * .Front,
- * .Back : Chaining.
- * .LayerInfo : Pointer to assigned "AreaInfo" structure.
- * .MaxBorder : Maximum layer size in screen coordinates.
- * .Border : Maximum visible area of the layer on the screen.
- * .FrontClip : Clip area for drawing onto the visible area. The area is the
- * union of all specified ClipRects.
- * .BackClip : Clip area for drawing into the background BitMap (only for
- * super bitmap). The border is specified in screen coordinates
- * and might be adjusted when necessary.
- * .FrontMap : Front Bitmap.
- * .BackMap : Background BitMap, NIL if missing.
- * .Damage : List of damaged screen areas.
- * .Flags : Flags (what else ?)
- * .Lock : Layer's lock. A layer must be locked before using elements
- * from it since operations with other layers might change them.
- * .Window : Slave pointer pointing to the corresponding window.
- * .ExtData : PRIVATE !
- * .BackColor : Background colour of the layer.
- * .DispX,
- * .DispY : Coordinates of the top left point in layer coordinates.
- * .Key : Current refresh key (refer to "BeginUpdate").
- * .ClipKey : actuall version of the layer, is incremented by one by any
- * layer operation that modifies the cliprects.
- * .BackHook : Current hook for layer back fill operations.
- *
- * Layer, .MmaxBorder
- * DispX /
- * / \ /
- * /+-------------------------+
- * DispY| | |
- * \| #############---------- visible area, .Border
- * | ############# |
- * | ############# |
- * | ############# |
- * | ############# |
- * | ############# |
- * | ############# |
- * | ############# |
- * | ############# |
- * | |
- * | |
- * +-------------------------+
- *
- * Layers should always be created and changed with the library functions as
- * support for disk-based BitMaps will be added and the structure will be
- * extended certainly.
- */
-
- typedef struct EL_SmartClip *EL_SmartPtr;
-
- struct EL_SmartClip { /* PRIVATE */
-
- struct EB_ClipRect Cliprect;
- E_EBitMapPtr EMapp;
- WORD DispX, DispY;
- E_EBitMapPtr EMap;
- };
-
- typedef struct EL_BackHook *EL_BackHookPtr;
-
- /*
- * EL_BackHook
- *
- * Descriptive structure for layer and layer info back fill function.
- * Calling conventions are:
- *
- * A0 map : E_EBitMapPtr : map to fill in
- * A1 UserData : APTR : own user data from hook
- * D0 x : WORD : left edge of rectangle
- * D1 y : WORD : top edge of rectangle
- * D2 w : WORD : width of rectangle
- * D3 h : WORD : height of rectangle
- * D4 ox : WORD : left offset of rectangle in full rectangle
- * D5 oy : WORD : top offset of rectangle in full rectangle
- *
- * Use this structure only in conjunction with EL_InstallLHook and
- * EL_InstallLIHook, never change the field in a layer or layerinfo structure
- * directly.
- *
- */
-
- struct EL_BackHook {
- VOID (*Call)();
- APTR UserData;
- };
-
- typedef struct EL_Layer *EL_LayerPtr;
-
- struct EL_Layer {
-
- EL_LayerPtr front, back;
- EL_LayerInfoPtr LayerInfo;
- struct EB_ClipRect MaxBorder, Border;
- EB_ClipRectPtr FrontClip, BackClip;
- E_EBitMapPtr FrontMap, BackMap;
- EB_ClipRectPtr Damage;
- EB_ClipRectPtr FrontSave, BackSave;
- ULONG Flags;
- struct SignalSemaphore Lock;
- WORD Pad_1;
- APTR Window;
- APTR ExtData;
- LONG BackColor;
- WORD DispX, DispY;
- LONG Key;
- LONG ClipKey;
- EL_BackHookPtr BackHook;
- };
-
-
-
- /*
- * LayerInfo, LayerInfoPtr
- *
- * Interface structure between a BitMap and the layers that use it. This
- * structure must be created if layers are to be used.
- *
- * !!! READ-ONLY !!!
- *
- * .First : Front layer on the screen.
- * .Last : Layer on the screen behind all other layers.
- * .AllLocks : Super-lock for all locks in the liste; if several layers
- * of a screen are to be locked, this semaphore must be locked
- * first (refer to "LockLayers" and "LockLayerInfo").
- * .Map : BitMap of that screen which the layers are belonging to.
- * .Port : Message port that refresh messages are sent to.
- * .BackColor : Background colour.
- * .BackPattern : Background pattern; if specified then the screen's back
- * ground is filled with the pattern, otherwise the background
- * colour is used. The pattern can have any size, the size
- * depends on its BitMap.
- * .Border : Border coordinates of the BitMap; a kind of ClipRect with
- * highest priority.
- *
- * LayerInfo structures should always be created and changed with the library
- * functions since it is possible that they are extended in future.
- */
-
- struct EL_LayerInfo {
-
- EL_LayerPtr First, Last;
- struct SignalSemaphore Lock;
- WORD Pad_1;
- struct List AllLocks;
- WORD Pad_2;
- E_EBitMapPtr Map;
- struct MsgPort *Port;
- LONG BackColor;
- E_EBitMapPtr BackPattern;
- struct EB_ClipRect Border;
- EL_BackHookPtr BackHook;
- };
-
-
-
- /*
- * LayerMsg, LayerMsgPtr
- *
- * Message that is sent when a layer wants refreshing.
- *
- * .Layer : Layer to be refreshed.
- * .Key : Current refresh key of the layer (refer to "BeginUpdate").
- *
- * This message must be replied after having received it.
- */
-
- typedef struct EL_LayerMsg *EL_LayerMsgPtr;
-
- struct EL_LayerMsg {
- struct Message Msg;
- EL_LayerPtr Layer;
- LONG Key;
- };
-
-
- #endif /* EGS_EGSLAYERS_H */
-